How do I pass a custom field to a hook (Invision Power Board [ipb] / PHP)

Posted by Julian Young on Stack Overflow See other posts from Stack Overflow or by Julian Young
Published on 2009-09-17T14:36:28Z Indexed on 2010/03/08 18:36 UTC
Read the original article Hit count: 1123

Filed under:
|
|
|
|

A long shot but here's hoping someone has some experience coding PHP hooks for Invisions Power Board forum.

I'm attempting to code a status addition and the PHP works fine on it's own, it's the passing of the IPB's reference to my hook that is the issue.

I.E. You setup a custom field in your forum for MSN Username, then from within a skin / template hook you pass the custom field to the hook and then use your PHP code to check on the status.

Here is the IPB skin code I am hooking into on Global->userInfoPane...

        <if test="authorcfields:|:$author['custom_fields'] != """>
                <foreach loop="customFieldsOuter:$author['custom_fields'] as $group => $data">
                        <foreach loop="customFields:$author['custom_fields'][ $group ] as $field">
                                <if test="$field != ''">
                                        <li>
                                                {$field}
                                        </li>
                                </if>
                        </foreach>
                </foreach>
        </if>

Although I could easily add my own skin hook here.

i.e.

<if test="myHookHere:|:1===1"></if>

Literally all I need is a single custom field entry from here passed to my hook. If I query every member when the hook is run then that will result in many extra sql queries per page view. All I want to do is pass that specific custom field to the hook...

i.e. myHookHere( $customfield['msn_username'] )

Is this possible? How do you reference the customfield? Can I execute pure PHP from here?

Appreciate anyone that can help! I tried the official invision forums but not had much luck.

© Stack Overflow or respective owner

Related posts about forum

Related posts about php